﻿<%@ Application Language="C#" %>

<script RunAt="server">

    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(HttpContext.Current.Server.MapPath("~/log4net.config")));



        try
        {
            // 执行加密算法中初始化部分

            HZ.Security.IEncrypt ienc = HZ.Security.EncryptFactory.Instance;
            if (ienc != null)
            {
                System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(ienc.Init));
                thread.Start();
            }
            else
            {
                HZ.Common.log4netManager.LogWarn("HttpMpdule", "未能正确加载加密系统", null);
            }
        }
        catch (Exception ee)
        {
            HZ.Common.log4netManager.LogWarn("HttpMpdule", "加密算法获取失败，请检查原因。", ee);
        }
        AppDomain.CurrentDomain.UnhandledException += (n, ex) =>
        {
            HZ.Common.log4netManager.LogFatal("系统发生故障", "系统发生致命故障，具体原因请看异常。", ex.ExceptionObject as Exception);

        };
    }

    void Application_End(object sender, EventArgs e)
    {
        //  Code that runs on application shutdown
        HZ.BidSystem.BLL.BLL_Service.Stop();
    }

    void Application_Error(object sender, EventArgs e)
    {
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e)
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>

